﻿/* 
 * OpenAfsSnapIn.cs
 * 
 * Author - Ankit Gupta and Gaurav Aggarwal
 * 
 * Registers and set properties of OpenAFSClient SnapIn.
 * 
 */

using System;
using System.ComponentModel;
using System.Security.Permissions;
using Microsoft.ManagementConsole;

// Set security options
[assembly: PermissionSetAttribute(SecurityAction.RequestMinimum, Unrestricted = true)]

namespace Microsoft.ManagementConsole.Project
{
    // RunInstaller attribute allows the .Net framework to install the target assembly 
    [RunInstaller(true)]
    public class InstallUtilSupport : SnapInInstaller
    {
    }

    // Set the registration information
    [SnapInSettings("{0913A26D-7AFE-42b2-ADB7-FF2B35247464}",
         DisplayName = "OpenAFS Client Service Manager",
         Description = "OpenAFS Client Service Manager")]

    // Initializes the snap-in
    public class OpenAfsSnapIn : SnapIn
    {
        public OpenAfsSnapIn()
        {
            // Create a snap-in node
            ScopeNode scopeNode = new ScopeNode();
            scopeNode.DisplayName = "OpenAFS Client Service Manager ";
            this.RootNode = scopeNode;

            // Add the listview description to the node
            FormViewDescription fvd = new FormViewDescription();
            fvd.DisplayName = "OpenAFS Client Service Manager";
            fvd.ViewType = typeof(openafsFormView);
            fvd.ControlType = typeof(openafsControl);
            scopeNode.ViewDescriptions.Add(fvd);
            scopeNode.ViewDescriptions.DefaultIndex = 0;
        }
    }
}